<?php



defined('IN_IA') or exit('Access Denied');

class Zst_marketingModuleWxapp extends WeModuleWxapp
{

    public function doPageSettings()
    {
        global $_GPC, $_W;

    }


    public function getOpenid($uid){
        global  $_W;
        $openid =  $_W['openid'];
        if(empty($openid)){
            if(!empty($uid)){
                $openid = mc_uid2openid($uid);
            } else {
                return '';
            }
        }
        return $openid;
    }

    public function doPageGetUserId(){
        global $_GPC, $_W;
        $uid = intval($_GPC['uid']);
        $openid = $this->getOpenid($uid);
        // 根据 openid 获取Userid
        $res = pdo_get('zst_marketing_user', array('openid' => $openid), array('user_id'));
        $userid = $res['user_id'];
        $this->result(0, '', array('userId' => $userid)); //  响应json串
    }



}
